#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT([trayinfo], [0.3.1], [kodest@gmail.com])
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AM_PROG_CC_C_O

# Checks for libraries.
AC_CHECK_LIB([ssl], [SSL_read], [AC_DEFINE(HAVE_LIBSSL, 1, [We have ssl]) enable_ssl=yes], [enable_ssl=no])

SRCREGFUNCS="regsrc_time, regsrc_netspeed, regsrc_cpu, regsrc_sensor"
SRCREGFUNCS="$SRCREGFUNCS, regsrc_acpitemp, regsrc_acpibatt"
SRCREGFUNCS="$SRCREGFUNCS, regsrc_mpd, regsrc_mhz, regsrc_ldavg"
if test x$enable_ssl = xyes; then
	LIBS="-lssl -lcrypto $LIBS"
	SRCREGFUNCS="$SRCREGFUNCS, regsrc_gmail"
fi

AC_DEFINE_UNQUOTED(SRCREGFUNCS, $SRCREGFUNCS, [Compiled in sources])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gettimeofday memchr memmove memset select socket strcasecmp strchr strdup strrchr strstr])

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT
